/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function initializeDrag(){

    var target = new Ext.dd.DDTarget('map_canvas', 'event');

    var proxy1 = new Ext.dd.DragSource('eventtype1', { group: 'event' });
    var proxy2 = new Ext.dd.DragSource('eventtype2', { group: 'event' });
    var proxy3 = new Ext.dd.DragSource('eventtype3', { group: 'event' });
    var proxy4 = new Ext.dd.DragSource('eventtype4', { group: 'event' });
    var proxy5 = new Ext.dd.DragSource('eventtype5', { group: 'event' });
    var proxy6 = new Ext.dd.DragSource('eventtype6', { group: 'event' });
    var proxy7 = new Ext.dd.DragSource('eventtype7', { group: 'event' });
    var proxy8 = new Ext.dd.DragSource('eventtype8', { group: 'event' });
	　　　　
    proxy1.afterDragDrop = function(target, e, id) {
        
        var destX = e.getPageX();
        var destY = e.getPageY();
        
        var left = parseInt(document.getElementById("map_canvas").style.left);
        var top = parseInt(document.getElementById("map_canvas").style.top);

        var coorX = destX - left;
        var coorY = destY - top;
        var pixel = new GPoint(coorX, coorY);
        var myLatlng = map.fromDivPixelToLatLng(pixel);
        
        var typeAndImg = getTypeAndImgFromDataById(this.id);
        var type = typeAndImg.type;
        var img = typeAndImg.img;
        
        newEventForm(destX, destY, type, myLatlng);
        
    };
    proxy2.afterDragDrop = proxy1.afterDragDrop;
    proxy3.afterDragDrop = proxy1.afterDragDrop;
    proxy4.afterDragDrop = proxy1.afterDragDrop;
    proxy5.afterDragDrop = proxy1.afterDragDrop;
    proxy6.afterDragDrop = proxy1.afterDragDrop;
    proxy7.afterDragDrop = proxy1.afterDragDrop;
    proxy8.afterDragDrop = proxy1.afterDragDrop;

}

